package com.vite;

import java.net.InetAddress;
import java.net.UnknownHostException;

import org.dromara.x.file.storage.spring.EnableFileStorage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

/**
 * 启动程序
 */
@EnableFileStorage
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class ViteApplication {
    public static void main(String[] args) throws UnknownHostException {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        ConfigurableApplicationContext application = SpringApplication.run(ViteApplication.class, args);
        System.out.println("Yi-Vite启动成功");
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        System.out.println(STR."""
            ---------------------------------------------------
             Local:        http://localhost:\{port}/
             Address:      http://\{ip}:\{port}/
             Knife4j:      http://\{ip}:\{port}/doc.html
            ---------------------------------------------------
        """);
    }
}
